<%@ page import="com.example.rk.entity.Admin" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>高校就业后端管理系统</title>
    <!-- 引入favicon图标 -->
    <link rel="shortcut icon" href="../ficon.ico">

    <jsp:include page="../common_css.jsp"/>
    <style>
        .jianli1 {
            border: 2px solid rgb(128, 191, 212);
            margin: 0 auto 20px;
            height: 50px;
            width: 800px;
        }

        .jianli2 {

            border: 2px solid rgb(128, 191, 212);
            margin: 0 auto;
            height: 400px;
            width: 800px;
        }

        .submit {
            display: inline-block;
            margin-left: 550px;
            height: 30px;
            width: 100px;
            background-color: rgb(128, 191, 212);
            border: none;
        }

        .form-control{
            margin: 0 auto;
            height: 500px;
            width: 900px;
        }
    </style>
</head>
<body>
<div class="container-scroller">
    <jsp:include page="../top.jsp"/>
    <div class="container-fluid page-body-wrapper">

        <div class="main-panel">
            <div class="row">
                <div class="col-md-12 stretch-card">
                    <div class="card">
                        <div class="table-responsive" align="center">
                                <form id="frm" class="form-control">
                                    <h1 class="h3 mb-3 font-weight-normal">编辑简历</h1>
                                    <label for="inputtitle" class="sr-only">题目</label>
                                    <input type="text" id="inputtitle" name="title" value="${resume.title}"class="jianli1"  >
                                    <label for="inputcontent" class="sr-only">内容</label>
                                    <textarea type="text" id="inputcontent" name="content" class="jianli2" >${resume.content}</textarea>
                                    <input type="hidden" id="inputsid" name="sid" value="${resume.sid}" class="form-control" placeholder="sid" >
                                    <input type="hidden" id="inputzt" name="zt" value="${resume.zt}" class="form-control" placeholder="zt" >
                                    <input type="hidden" id="inputid" name="id" value="${resume.id}" class="form-control" placeholder="ID" >
                                    <button class="btn btn-lg btn-primary btn-block" type="button" onclick="doEdit()" style="width: 30%">编辑</button>
                                </form>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <jsp:include page="../footer.jsp"/>
    </div>
    <!-- main-panel ends -->
</div>
<!-- page-body-wrapper ends -->
</div>
<!-- container-scroller -->
<jsp:include page="../common_js.jsp"/>
</body>

</html>


<script>
    function doEdit() {
        //推荐前端js验证字段
        var inputtitle =$("#inputtitle").val();
        var inputcontent =$("#inputcontent").val();
        if (inputtitle == '' || inputcontent == '') {
            alert("标题内容不能为空");
        }else{
            $.ajax(
                {
                    type:"post",
                    url:"/resume/doEdit",
                    data:$("#frm").serialize(),
                    async:false,  //使用ajax同步提交数据
                    success:function (response) {
                        if (response=="ok"){
                            alert("编辑成功,1秒后跳转");
                            setTimeout(window.location.href="/resume/list",1000);
                        }else{
                            alert("编辑失败");
                        }
                    }
                }
            );
        }
    }
</script>

